Visual C++ Projects: Add rules to generate GTK DBus sources
authorChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 27 Nov 2013 10:05:32 +0000 (18:05 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 27 Nov 2013 10:05:32 +0000 (18:05 +0800)
Since commit 7c2a5072 the gtkdbusgenerated.[c|h] are not included in the
dist tarball and thus have to be generated, which broke the Visual C++
builds.

This patch adds property sheets and custom build rules for the Visual C++
projects so that gtkdbusgenerated.[c|h] will be generated upon building the
GTK+ DLL sources.

This also tells people building GTK+ from the projects that they need to
have Python 2/3 installed and the Python interpretor needs to be in their
PATH before building GTK+ from the projects.

build/win32/vs10/Makefile.am
build/win32/vs10/README.txt
build/win32/vs10/gtk-gen-sources.props [new file with mode: 0644]
build/win32/vs10/gtk-version-paths.props
build/win32/vs10/gtk.vcxproj.filtersin
build/win32/vs10/gtk.vcxprojin
build/win32/vs9/Makefile.am
build/win32/vs9/README.txt
build/win32/vs9/gtk-gen-sources.vsprops [new file with mode: 0644]
build/win32/vs9/gtk-version-paths.vsprops
build/win32/vs9/gtk.vcprojin

index 44b2883d1b93fb8e6082e7b3fdaf406796669684..0a0120ba6fdcc93267ef53a438261d22916664e9 100644 (file)
@@ -37,6 +37,7 @@ EXTRA_DIST += \
        gtk-version-paths.props \
        gtkprebuild-broadway.props      \
        gtkprebuild.props       \
-       gtk-copy-gdk-broadway.props
+       gtk-copy-gdk-broadway.props     \
+       gtk-gen-sources.props
 
 -include $(top_srcdir)/git.mk
index 64c62ddd983bbf929558f28baff3586dfdff61d3..e00b0833a4815f1fd5ec3ff3a7e8a28ccb32e4e3 100644 (file)
@@ -20,6 +20,11 @@ ATK and GLib.  External dependencies are at least Cairo
 gettext-runtime, fontconfig*, freetype*, expat*.  See the \r
 build/win32/vs10/README.txt file in glib for details where to unpack them.\r
 \r
+You will also need a Python 2.x/3.x interpretor installed on your system,\r
+which can be obtained from the official installers available from\r
+http://www.python.org.  Please note that the Python interpretor (python.exe)\r
+needs to be in your path before attempting the build of GTK+.\r
+\r
 It is recommended that one builds the dependencies with VS10 as far as\r
 possible, especially those from and using the GTK+ stack (i.e. GLib,\r
 Cairo, ATK, Pango, GDK-Pixbuf), so that crashes caused by mixing calls\r
diff --git a/build/win32/vs10/gtk-gen-sources.props b/build/win32/vs10/gtk-gen-sources.props
new file mode 100644 (file)
index 0000000..a2cdd1e
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ImportGroup Label="PropertySheets">\r
+    <Import Project="gtk-build-defines.props" />\r
+  </ImportGroup>\r
+  <PropertyGroup Label="UserMacros">\r
+    <GenerateGtkDbusBuiltSources>\r
+cd ..\..\..\gtk\r
+\r
+python $(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix org.Gtk. --c-namespace _Gtk --generate-c-code gtkdbusgenerated ./gtkdbusinterfaces.xml\r
+\r
+cd $(SolutionDir)\r
+    </GenerateGtkDbusBuiltSources>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <BuildMacro Include="GenerateGtkDbusBuiltSources">\r
+      <Value>$(GenerateGtkDbusBuiltSources)</Value>\r
+    </BuildMacro>\r
+  </ItemGroup>\r
+</Project>
\ No newline at end of file
index fe2829f05e503cca1455683e8dbc6bdb62d9280c..62c244a2854621fd4b1df722f15790c564b3227d 100644 (file)
@@ -2,9 +2,9 @@
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup Label="UserMacros">\r
     <VSVer>10</VSVer>\r
-    <GlibEtcInstallRoot>..\..\..\..\vs$(VSVer)\$(Platform)</GlibEtcInstallRoot>\r
+    <GlibEtcInstallRoot>$(SolutionDir)\..\..\..\..\vs$(VSVer)\$(Platform)</GlibEtcInstallRoot>\r
     <GlibEtcInstallRootFromBuildWin32>..\..\..\vs$(VSVer)\$(Platform)</GlibEtcInstallRootFromBuildWin32>\r
-    <CopyDir>$(GlibEtcInstallRoot)</CopyDir>\r
+    <CopyDir>..\..\..\..\vs$(VSVer)\$(Platform)</CopyDir>\r
     <ApiVersion>3.0</ApiVersion>\r
     <GtkLibtoolCompatibleDllPrefix>lib</GtkLibtoolCompatibleDllPrefix>\r
     <GtkLibtoolCompatibleDllSuffix>-$(ApiVersion)-0</GtkLibtoolCompatibleDllSuffix>\r
index b5b1c9879e690f2ba528a0daac05e6183cff1175..f6be8055fcf915f27118ed20a96e498b415bb887 100644 (file)
@@ -17,6 +17,9 @@
   <ItemGroup>
     <ResourceCompile Include="..\..\..\gtk\gtk-win32.rc"><Filter>Resource Files</Filter></ResourceCompile>
   </ItemGroup>
+  <ItemGroup>
+    <CustomBuild Include="..\..\..\gtk\gtkdbusinterfaces.xml"><Filter>Resource Files</Filter></CustomBuild>
+  </ItemGroup>
   <ItemGroup>
 #include "libgtk.vs10.sourcefiles.filters"
     <ClCompile Include="..\..\..\modules\input\gtkimcontextime.c"><Filter>Source Files</Filter></ClCompile>
index 08057d9174b3e6f4d815e87b8929ca7e64d65cb1..80a94b3c53b610bfad37a63148eb9d96318c104a 100644 (file)
   </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="gtk-build-defines.props" />
+    <Import Project="gtk-gen-sources.props" />
   </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="gtk-build-defines.props" />
+    <Import Project="gtk-gen-sources.props" />
   </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="gtk-build-defines.props" />
+    <Import Project="gtk-gen-sources.props" />
   </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="gtk-build-defines.props" />
+    <Import Project="gtk-gen-sources.props" />
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
       <TargetMachine>MachineX64</TargetMachine>
     </Link>
   </ItemDefinitionGroup>
+  <ItemGroup>
+    <CustomBuild Include="..\..\..\gtk\gtkdbusinterfaces.xml">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating GTK+ DBus Sources...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GenerateGtkDbusBuiltSources)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating GTK+ DBus Sources...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GenerateGtkDbusBuiltSources)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generating GTK+ DBus Sources...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GenerateGtkDbusBuiltSources)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating GTK+ DBus Sources...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GenerateGtkDbusBuiltSources)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h%(Outputs)</Outputs>
+    </CustomBuild>
+  </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\..\..\gtk\gtk-win32.rc" />
   </ItemGroup>
index f56ec64236a7b81425d2948eb8a8f8b472f4d253..116847a333a17d7ae0c897c1051ede67d5a1b58c 100644 (file)
@@ -25,6 +25,7 @@ EXTRA_DIST += \
        gtk-version-paths.vsprops       \
        gtkprebuild.vsprops     \
        gtkprebuild-broadway.vsprops    \
-       gtk-copy-gdk-broadway.vsprops
+       gtk-copy-gdk-broadway.vsprops   \
+       gtk-gen-sources.vsprops
 
 -include $(top_srcdir)/git.mk
index 7f0c6ba355bff835c98e6afcbbf76f96c57ef75d..0cf37f4bbca03e9621e39709f87588d7d8d12d5f 100644 (file)
@@ -19,6 +19,11 @@ ATK and GLib.  External dependencies are at least Cairo
 gettext-runtime, fontconfig*, freetype*, expat*.  See the \r
 build/win32/vs9/README.txt file in glib for details where to unpack them.\r
 \r
+You will also need a Python 2.x/3.x interpretor installed on your system,\r
+which can be obtained from the official installers available from\r
+http://www.python.org.  Please note that the Python interpretor (python.exe)\r
+needs to be in your path before attempting the build of GTK+.\r
+\r
 It is recommended that one builds the dependencies with VS9 as far as\r
 possible, especially those from and using the GTK+ stack (i.e. GLib,\r
 Cairo, ATK, Pango, GDK-Pixbuf), so that crashes caused by mixing calls\r
diff --git a/build/win32/vs9/gtk-gen-sources.vsprops b/build/win32/vs9/gtk-gen-sources.vsprops
new file mode 100644 (file)
index 0000000..c6f87c5
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioPropertySheet\r
+       ProjectType="Visual C++"\r
+       Version="8.00"\r
+       Name="gtkgensourcesprops"\r
+       InheritedPropertySheets=".\gtk-build-defines.vsprops"\r
+       >\r
+       <UserMacro\r
+               Name="GenerateGtkDbusBuiltSources"\r
+               Value="\r
+cd ..\..\..\gtk&#x0D;&#x0A;\r
+python $(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix org.Gtk. --c-namespace _Gtk --generate-c-code gtkdbusgenerated ./gtkdbusinterfaces.xml&#x0D;&#x0A;\r
+cd $(SolutionDir)&#x0D;&#x0A;\r
+                     "\r
+       />\r
+</VisualStudioPropertySheet>
\ No newline at end of file
index 7a97b1895a860ade905226b0738977654d44cf8f..5fbda28efd673a2e0fc758a8eaf8eec9cfeb0ea1 100644 (file)
@@ -10,7 +10,7 @@
        />\r
        <UserMacro\r
                Name="GlibEtcInstallRoot"\r
-               Value="..\..\..\..\vs$(VSVer)\$(PlatformName)"\r
+               Value="$(SolutionDir)\..\..\..\..\vs$(VSVer)\$(PlatformName)"\r
        />\r
        <UserMacro\r
                Name="GlibEtcInstallRootFromBuildWin32"\r
@@ -18,7 +18,7 @@
        />\r
        <UserMacro\r
                Name="CopyDir"\r
-               Value="$(GlibEtcInstallRoot)"\r
+               Value="..\..\..\..\vs$(VSVer)\$(PlatformName)"\r
        />\r
        <UserMacro\r
                Name="ApiVersion"\r
index 5ff0484a7b170fceddb4ef304080c2c39ed1ae2e..ebd6ab63d3702a6272dd43690ec8ba07982ce4f7 100644 (file)
@@ -21,7 +21,7 @@
        <Configurations>\r
                <Configuration\r
                        Name="Debug|Win32"\r
-                       InheritedPropertySheets=".\gtk-build-defines.vsprops"\r
+                       InheritedPropertySheets=".\gtk-gen-sources.vsprops"\r
                        ConfigurationType="2"\r
                        CharacterSet="2"\r
                        >\r
@@ -53,7 +53,7 @@
                </Configuration>\r
                <Configuration\r
                        Name="Release|Win32"\r
-                       InheritedPropertySheets=".\gtk-build-defines.vsprops"\r
+                       InheritedPropertySheets=".\gtk-gen-sources.vsprops"\r
                        ConfigurationType="2"\r
                        CharacterSet="2"\r
                        WholeProgramOptimization="1"\r
@@ -85,7 +85,7 @@
                </Configuration>\r
                <Configuration\r
                        Name="Debug|x64"\r
-                       InheritedPropertySheets=".\gtk-build-defines.vsprops"\r
+                       InheritedPropertySheets=".\gtk-gen-sources.vsprops"\r
                        ConfigurationType="2"\r
                        CharacterSet="2"\r
                        >\r
                </Configuration>\r
                <Configuration\r
                        Name="Release|x64"\r
-                       InheritedPropertySheets=".\gtk-build-defines.vsprops"\r
+                       InheritedPropertySheets=".\gtk-gen-sources.vsprops"\r
                        ConfigurationType="2"\r
                        CharacterSet="2"\r
                        WholeProgramOptimization="1"\r
                        Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
                        UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
                        >\r
+                       <File RelativePath="..\..\..\gtk\gtkdbusinterfaces.xml">\r
+                               <FileConfiguration Name="Debug|Win32">\r
+                               <Tool Name="VCCustomBuildTool"\r
+                                               Description="Generating GTK+ DBus Sources..."\r
+                                               CommandLine="$(GenerateGtkDbusBuiltSources)"\r
+                                               Outputs="..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration Name="Release|Win32">\r
+                                       <Tool Name="VCCustomBuildTool"\r
+                                               Description="Generating GTK+ DBus Sources..."\r
+                                               CommandLine="$(GenerateGtkDbusBuiltSources)"\r
+                                               Outputs="..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration Name="Debug|x64">\r
+                                       <Tool Name="VCCustomBuildTool"\r
+                                               Description="Generating GTK+ DBus Sources..."\r
+                                               CommandLine="$(GenerateGtkDbusBuiltSources)"\r
+                                               Outputs="..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration Name="Release|x64">\r
+                                       <Tool Name="VCCustomBuildTool"\r
+                                               Description="Generating GTK+ DBus Sources..."\r
+                                               CommandLine="$(GenerateGtkDbusBuiltSources)"\r
+                                               Outputs="..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h"\r
+                                       />\r
+                               </FileConfiguration>\r
+                       </File>\r
                        <File RelativePath="..\..\..\gtk\gtk-win32.rc" />\r
                </Filter>\r
                <Filter\r